package com.kaifamiao.statements;

import java.util.Scanner;

public class Duck {
    public static void main(String[] args) {

        // for( 初始化; 条件; 迭代部分 ) {
        //   循环体
        // }
        for(int counter = 10; counter > 0 ; counter--) {
            System.out.printf("%d\t", counter);
        }
        System.out.println();

        System.out.println( "- ".repeat( 20 ) );

        int sum = 0;
        for( int n = 1 ; n <= 100 ; n++ ){
            sum += n ;
        }
        System.out.println( sum );

        System.out.println( "- ".repeat( 20 ) );

        final int x = 9527;
        for( int temp = x ; temp > 0 ; temp /= 10 ){
            int yu = temp % 10;
            System.out.printf("%d, " , yu);
        }
        System.out.println();

        Scanner s = new Scanner( System.in );

        System.out.println("请输入你的年龄");
        int age = s.nextInt();
        for( ; age < 0 || age > 150 ; ){
            System.out.println( "你输入的年龄不符合正常人类的寿命范围，请重新输入" );
            age = s.nextInt();
        }

        System.out.println( "你输入的年龄是: " + age );

        s.close();

    }
}
